package teach.aistar.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import teach.aistar.model.entity.*;
import teach.aistar.service.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
public class WebOrderController {

    @Autowired
    private IWebOrderService iWebOrderService;



    @GetMapping("user/seckill-list")
    public String add(HttpServletRequest request, HttpSession session){
        String uname = (String) session.getAttribute("uname");
//        String price = request.getParameter("price");
//        System.out.println("秒杀的金额为:"+price);
//        String id = request.getParameter("id");
//        Long sekid = Long.valueOf(id);
//        List<WebOrder> sekId = iWebOrderService.findSekId(uname);
//        Double price = sekId.getPrice();


        List<WebOrder> webOrders = iWebOrderService.selectWebOrderAll(uname);

//        session.setAttribute("prices",price);
        request.setAttribute("webOrderList",webOrders);
//        request.setAttribute("price",price);
        return "seckill-list";
    }
}
